<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>登录界面</title>
    <link rel="stylesheet" href="https://cdn.staticfile.net/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.net/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.net/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<script src="https://cdn.staticfile.net/jquery/1.10.2/jquery.min.js"></script>
<script>
    //判断是否存在账号
    $(function () {
        $("#username").blur(function () {
            $.ajax({
                type: "POST",
                url: "/checkName",
                data: {"username": $("#username").val()},//document.getElementById("username").value
                success: function (result) {
                    // console.log("result---" + result);
                    if (result == "true") {
                        $("#msg").html("可以登录").css("color", "red")
                        // document.getElementById("msg").innerHTML = "可以登录"
                    } else {
                        $("#msg").html("用户名不存在，请注册").css("color", "green")
                        // document.getElementById("msg").innerHTML = "用户名不存在，请注册"
                    }
                },
            })
        });
    })
</script>
<body>
<form action="/login" method="post">
    <input type="text" class="form-control" name="username" id="username"
           placeholder="请输入用户名">
    <input type="password" class="form-control" name="password" id="password"
           placeholder="请输入密码">
    <input type="submit" value="登录">
</form>
<input type="checkbox" id="autoLogin">一周免登录 <br/>
<a href="register.html">注册新用户</a>

</body>
</html>